package com.jihu.design.behavioral.interpreter;

/**
 * @author jihu
 * @date 2021/10/9
 */
public class OrExpression extends IDCardExoression {

    private IDCardExoression cityExp;
    private IDCardExoression typeExp;

    public OrExpression(IDCardExoression cityExp,IDCardExoression typeExp){
        this.cityExp = cityExp;
        this.typeExp = typeExp;
    }



    @Override
    boolean interpret(String expression) {
        //定义所有非终结表达式的合并逻辑
        return  cityExp.interpret(expression) || typeExp.interpret(expression);
    }
}
